# Table 3: Regression analysis of prevalence of selected topics 

# Clear all
rm(list=ls(all=TRUE))

# Import data
setwd("P:/2017-pathways/new/2-data")
load("thetameta2.Rdata")

# Storing regression models
m1<- lm(thetaperc2 ~ 0+treatment1+treatment2+treatment3+
            female+age+he+west+urban,
            data=thetameta2)

m2<- lm(thetaperc2 ~ 0+treatment1+treatment2+treatment3+
            female+age+he+west+urban+
            lofoten+worried+oilwork2,
          data=thetameta2)

m3<- lm(thetaperc3 ~ 0+treatment1+treatment2+treatment3+
            female+age+he+west+urban,
          data=thetameta2)

m4<- lm(thetaperc3 ~ 0+treatment1+treatment2+treatment3+
            female+age+he+west+urban+
            lofoten+worried+oilwork2,
          data=thetameta2)

m5<- lm(thetaperc8 ~ 0+treatment1+treatment2+treatment3+
            female+age+he+west+urban,
          data=thetameta2)

m6<- lm(thetaperc8 ~ 0+treatment1+treatment2+treatment3+
            female+age+he+west+urban+
            lofoten+worried+oilwork2,
          data=thetameta2)

summary(m1)
summary(m2)
summary(m3)
summary(m4)
summary(m5)
summary(m6)

# with estimateEffects
library(stm)
setwd("P:/2017-pathways/new/4-model-output")
load("pathwaysPrevFit9.Rdata")

thetameta3<-

eE1 <- estimateEffect(c(2) ~ treatment+female+age+he+west+urban,
                      pathwaysPrevFit9, meta=thetameta2)
eE1 <- estimateEffect(c(2) ~ treatment+female+age+he+west+urban+
                        lofoten+worried+oilwork2,
                      pathwaysPrevFit9, meta=thetameta2)
eE1 <- estimateEffect(c(3) ~ treatment+female+age+he+west+urban,
                      pathwaysPrevFit9, meta=thetameta2)
eE1 <- estimateEffect(c(3) ~ treatment+female+age+he+west+urban+
                        lofoten+worried+oilwork2,
                      pathwaysPrevFit9, meta=thetameta2)
eE1 <- estimateEffect(c(8) ~ treatment+female+age+he+west+urban,
                      pathwaysPrevFit9, meta=thetameta2)
eE1 <- estimateEffect(c(8) ~ treatment+female+age+he+west+urban+
                        lofoten+worried+oilwork2,
                      pathwaysPrevFit9, meta=thetameta2)

summary(eE1)
summary(m1)

summary(eE2)
summary(m2)

summary(eE3)
summary(m3)

summary(eE4)
summary(m4)

summary(eE5)
summary(m5)

summary(eE6)
summary(m6)
